import os
import csv
# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html


class Pipeline_ToCSV(object):
    def __init__(self):
        store_file = os.path.dirname(__file__)+'/huibo.csv'
        self.file = open(store_file,'wb')
        self.writer = csv.writer(self.file)

    def process_item(self, item, spider):
        print("process_item!")
#        self.writer.writerow(item['stock_id'],item['share_time'])
        return item

    def close_spider(self,spider):
        self.file.close()


